from django.db import models
from django.contrib.auth.models import AbstractUser


class User(AbstractUser):
    phone = models.CharField(max_length=11)
    code = models.CharField(max_length=6)


class Code(models.Model):
    code = models.CharField(max_length=6)
    phone = models.CharField(max_length=11)
    created = models.DateTimeField(auto_now_add=True)


class Token(models.Model):
    key = models.CharField(max_length=32)
    user = models.OneToOneField(User, on_delete=True)
    created = models.DateTimeField(auto_now_add=True)
